\documentclass[a4paper,10pt,titlepage]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage[colorlinks=true, linkcolor=cyan]{hyperref}
\usepackage{graphicx}

%opening
\title{TDT4205 - PS1}
\author{Lars Martin S. Pedersen}

\begin{document}
\maketitle

\tableofcontents
\newpage

\section{Task 1}
\begin{verbatim}
$ gcc --version & flex --version & bison --version
gcc (GCC) 4.2.3 (Ubuntu 4.2.3-2ubuntu7)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

flex 2.5.34

bison (GNU Bison) 2.3
Written by Robert Corbett and Richard Stallman.

Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
\end{verbatim}

\section{Task 2}
A \textit{lexical analyzer} reads a sequence of characters, groups them into
\textit{lexemes}, and produce a meaningful \textit{token} out of each lexeme.
The tokens are then passed on to the subsequent face of syntax analysis. An
\textit{acceptor} reads a sequence of characters, and based on wether the input
is valid or not, gives a binary output of \textit{yes} or \textit{no}.

\section{Task 3}
\begin{enumerate}
  \item See figure \ref{fig:nfa}. 
\begin{figure}[htb]
\centering
\includegraphics[scale=0.5]{nfa.png}
\caption{NFA for the language 1(0|1)*00(0|1)*.}
\label{fig:nfa}
\end{figure}
  \item The language includes any word starting with 1, followed by a sequence
  of zeros or ones of arbitrary length, then double 0 and another sequence of
  zeros and ones. Because of the \textit{Kleene star}, the sequences can
  be from zero to any number of digits in length. Examples: \verb|100|,
  \verb|101010100111|, \verb|10011100|.
  \item See table \ref{tbl:trans}.
\begin{table}[htb]
\centering
\begin{tabular}{ c | c | c | c }
 & \textbf{0} & \textbf{1} & \textbf{$\epsilon$} \ \\ \hline
\textbf{$S_0$} & $\oslash$ & $S_1$ & $\oslash$ \\ \hline
\textbf{$S_1$} & $\oslash$ & $\oslash$ & $\{S_2, S_3, S_7\}$ \\ \hline 
\textbf{$S_2$} & $S_4$ & $\oslash$ & $\oslash$ \\ \hline
\textbf{$S_3$} & $\oslash$ & $S_5$ & $\oslash$ \\ \hline
\textbf{$S_4$} & $\oslash$ & $\oslash$ & $S_6$ \\ \hline
\textbf{$S_5$} & $\oslash$ & $\oslash$ & $S_6$ \\ \hline
\textbf{$S_6$} & $\oslash$ & $\oslash$ & $\{S_1, S_7\}$ \\ \hline
\textbf{$S_7$} & $S_8$ & $\oslash$ & $\oslash$ \\ \hline
\textbf{$S_8$} & $S_9$ & $\oslash$ & $\oslash$ \\ \hline
\textbf{$S_9$} & $\oslash$ & $\oslash$ & $S_1$ 
\end{tabular}
\caption{Transition table for the NFA in figure \ref{fig:nfa}.}
\label{tbl:trans}
\end{table}
\end{enumerate}

\section{Task 4}
\begin{figure}[htb]
\centering
\includegraphics[scale=0.5]{dfa.png}
\caption{DFA for floating point constants in C.}
\label{fig:dfa}
\end{figure}

\section{Task 5}
See external file, \href{run:parens.c}{parens.c}.
\end{document}